package com.pap.spidemo.demo.controller;

import com.pap.obj.vo.logineduser.LoginedUserVO;
import com.pap.obj.vo.response.ResponseVO;
import com.pap.spidemo.demo.service.IItemPrice;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.math.BigDecimal;

@Controller
public class ItemPriceController {

    @Resource
    private IItemPrice itemPriceProxy;

    @ResponseBody
    @GetMapping(value = "/demo")
    public ResponseVO<String> price(@RequestParam("itemType") String itemType){
        LoginedUserVO loginedUserVO = new LoginedUserVO();
        loginedUserVO.setClientLicenseId(itemType);
        BigDecimal price = itemPriceProxy.execute("itemId", loginedUserVO);
        return ResponseVO.successdata(price);
    }

}
